package com.duoduo.springcloud.controller;

import com.duoduo.springcloud.service.IMessageProvider;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * SendMessageController
 *
 * @author qian
 * @version 1.0
 * @date 2020/12/1 15:23
 */
@RestController
public class SendMessageController {

    @Resource
    private IMessageProvider messageProvider;

    @GetMapping(value = "/sendMessage")
    public String sendMessage(@RequestParam(required = false)String msg){
        if(StringUtils.isEmpty(msg)){
            return messageProvider.send();
        }
        return messageProvider.send(msg);
    }
}
